<template>
	<view class="user-panel">
		<view class="header">
			<view class="header_title">
				<view class="title-text">今天</view>
				<view class="date">4月18日周六</view>
			</view>
			<view class="header_search">
				<view class="search_wrapper" @tap="handleSearch">
					<input type="text" placeholder="快速搜索" class="search_input" disabled />
					<view class="search-icon-box">
						<image class="search_icon" src="/static/index主页/search@2x.png"></image>
					</view>
				</view>
			</view>
		</view>
		
		<view class="user-info" v-if="false">
			<view class="avatar-container">
				<image class="avatar" :src="userAvatar"></image>
			</view>
			<view class="user-details">
				<view class="username">{{username}}</view>
				<view class="user-stat">{{completedCount}}/{{totalCount}} 已完成</view>
			</view>
		</view>
		<view class="action-buttons" v-if="false">
			<view class="action-button" @tap="handleSearch">
				<image class="action-icon" src="/static/index主页/search@2x.png"></image>
			</view>
			<view class="action-button" @tap="handleAdd">
				<image class="action-icon" src="/static/index主页/add@2x.png"></image>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "UserPanel",
		props: {
			username: {
				type: String,
				default: '用户'
			},
			userAvatar: {
				type: String,
				default: '/static/index主页/avatar@2x.png'
			},
			completedCount: {
				type: Number,
				default: 0
			},
			totalCount: {
				type: Number,
				default: 0
			}
		},
		methods: {
			handleSearch() {
				this.$emit('search');
			},
			
			handleAdd() {
				this.$emit('add');
			}
		}
	}
</script>

<style scoped>
	.user-panel {
		width: 100%;
		background-color: #fff;
		color: #333;
		position: relative;
	}
	
	.header {
		padding: 30rpx;
		width: 100%;
		background-color: #fff;
		box-sizing: border-box;
	}
	
	.header_title {
		position: relative;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		font-weight: 500;
		margin-top: 60rpx;
		margin-bottom: 20rpx;
	}
	
	.title-text {
		font-size: 48rpx;
		color: rgba(0, 0, 0, 1);
		text-align: center;
	}
	
	.date {
		font-size: 28rpx;
		color: rgba(0, 0, 0, 1);
		margin-top: 10rpx;
		text-align: center;
	}
	
	.header_search {
		position: relative;
		margin-top: 30rpx;
		padding-bottom: 20rpx;
	}
	
	.search_wrapper {
		position: relative;
		width: 100%;
		height: 80rpx;
		background-color: #f5f5f5;
		border-radius: 40rpx;
		padding: 0 80rpx 0 30rpx;
		font-size: 28rpx;
		box-sizing: border-box;
	}
	
	.search_input {
		width: 100%;
		height: 100%;
		border: none;
		background: none;
		pointer-events: none;
	}
	
	.search-icon-box {
		position: absolute;
		right: 30rpx;
		top: 50%;
		transform: translateY(-50%);
		width: 60rpx;
		height: 60rpx;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	
	.search_icon {
		width: 40rpx;
		height: 40rpx;
	}
	
	/* 以下是原UserPanel样式，已隐藏 */
	.user-info {
		display: flex;
		align-items: center;
	}
	
	.user-details {
		display: flex;
		flex-direction: column;
	}
	
	.username {
		font-size: 32rpx;
		font-weight: 500;
		margin-bottom: 10rpx;
	}
	
	.user-stat {
		font-size: 24rpx;
		opacity: 0.8;
	}
	
	.action-buttons {
		display: flex;
	}
	
	.action-button {
		width: 60rpx;
		height: 60rpx;
		background-color: rgba(255, 255, 255, 0.3);
		border-radius: 50%;
		display: flex;
		align-items: center;
		justify-content: center;
		margin-left: 20rpx;
	}
	
	.action-icon {
		width: 30rpx;
		height: 30rpx;
	}
</style> 